package fnic.jsontrans;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

public class SearchQueryJsonMode {

	InQueryParam<Serializable> input;
	boolean needtotalhits;
	List<String> output;
	InStatParam<Serializable> statistic;

	public static class InQueryParam<T extends Serializable>{
		public String getName() {
			return name;
		}
		public T getContent() {
			return content;
		}
		public void setName(String name) {
			this.name = name;
		}
		public void setContent(T content) {
			this.content = content;
		}
		
		String name;
		T content;
	}
	
	public static class InStatParam<T extends Serializable>{
		public String getName() {
			return name;
		}
		public T getContent() {
			return content;
		}
		public void setName(String name) {
			this.name = name;
		}
		public void setContent(T content) {
			this.content = content;
		}
		
		String name;
		T content;
	}
	
	public static class IdsQueryParam implements Serializable{	
		String name;
		List<String> value;
		
		public List<String> getValue() {
			return value;
		}
		public void setValue(List<String> value) {
			this.value = value;
		}
		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		@Override
		public String toString() {
			return "IdsQueryParam [name=" + name + ", value=" + value + "]";
		}
	}
	
	public static class KeyWordQueryParam implements Serializable{	
		String name;
		List<String> value;
		
		public List<String> getValue() {
			return value;
		}
		public void setValue(List<String> value) {
			this.value = value;
		}
		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		@Override
		public String toString() {
			return "KeyWordQueryParam [name=" + name + ", value=" + value + "]";
		}
	}
	
	public static class PrefixQueryParam implements Serializable{
		public String getName() {
			return name;
		}
		public List<String> getValue() {
			return value;
		}
		public void setName(String name) {
			this.name = name;
		}
		public void setValue(List<String> value) {
			this.value = value;
		}
		
		@Override
		public String toString() {
			return "PrefixQueryParam [name=" + name + ", value=" + value + "]";
		}

		String name;
		List<String> value;
	}
	
	public static class RegexQueryParam implements Serializable{
		public String getName() {
			return name;
		}
		public List<String> getValue() {
			return value;
		}
		public void setName(String name) {
			this.name = name;
		}
		public void setValue(List<String> value) {
			this.value = value;
		}
		
		@Override
		public String toString() {
			return "RegexQueryParam [name=" + name + ", value=" + value + "]";
		}

		String name;
		List<String> value;
	}
	
	public static class RangeQueryParam implements Serializable{
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public List<FromTo> getValue() {
			return value;
		}
		public void setValue(List<FromTo> value) {
			this.value = value;
		}
		
		@Override
		public String toString() {
			return "RangeQueryParam [name=" + name + ", value=" + value + "]";
		}
		
		String name;
		List<FromTo> value;
	}
	
	public static class FuzzyQueryParam implements Serializable{
		public String getName() {
			return name;
		}
		public void setName(String fzyfield) {
			this.name = fzyfield;
		}
		public String getPrecision() {
			return precision;
		}
		public void setPrecision(String precision) {
			this.precision = precision;
		}
		public String getTolerance() {
			return tolerance;
		}
		public void setTolerance(String tolerance) {
			this.tolerance = tolerance;
		}
		
		@Override
		public String toString() {
			return "FuzzyQueryParam [name=" + name + ", precision=" + precision
					+ ", tolerance=" + tolerance + "]";
		}

		String name;
		String precision;
		String tolerance;
	}
	
	public static class GEOQueryParam implements Serializable{
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
		public List<PositionCycle> getValue() {
			return value;
		}
		public void setValue(List<PositionCycle> value) {
			this.value = value;
		}
		
		@Override
		public String toString() {
			return "GEOQueryParam [name=" + name + ", value=" + value + "]";
		}

		String name;
		List<PositionCycle> value;
	}
	
	public static class InTermFieldStat implements Serializable{
		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		@Override
		public String toString() {
			return "InTermFieldStat [name=" + name + "]";
		}

		String name;
	}

	public static class InTermsKVStat implements Serializable{
		public String getKeystatfield() {
			return keystatfield;
		}
		public String getValuestatfield() {
			return valuestatfield;
		}
		public void setKeystatfield(String keystatfield) {
			this.keystatfield = keystatfield;
		}
		public void setValuestatfield(String valuestatfield) {
			this.valuestatfield = valuestatfield;
		}
		public List<Integer> getMethod() {
			return method;
		}
		public void setMethod(List<Integer> method) {
			this.method = method;
		}
		
		@Override
		public String toString() {
			return "InTermsKVStat [keystatfield=" + keystatfield
					+ ", valuestatfield=" + valuestatfield + ", method="
					+ method + "]";
		}

		String keystatfield;
		String valuestatfield;
		List<Integer> method;	
	}
	
	public static class InNumFieldStat implements Serializable{
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public List<Integer> getMethod() {
			return method;
		}
		public void setMethod(List<Integer> method) {
			this.method = method;
		}
		
		@Override
		public String toString() {
			return "InNumFieldStat [name=" + name + ", method=" + method + "]";
		}

		String name;
		List<Integer> method;
	}
	
	public static class InRangesGroupStat implements Serializable{
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public boolean isIncludeBound() {
			return includeBound;
		}
		public void setIncludeBound(boolean includeBound) {
			this.includeBound = includeBound;
		}
		public List<FromTo> getRanges() {
			return ranges;
		}
		public void setRanges(List<FromTo> ranges) {
			this.ranges = ranges;
		}
		public List<Integer> getMethod() {
			return method;
		}
		public void setMethod(List<Integer> method) {
			this.method = method;
		}
		
		String name;
		boolean includeBound;   //暂时不解析，默认为true
		List<FromTo> ranges;
		List<Integer> method;	
	}
	
	public static class FromTo{
		public String getFrom() {
			return from;
		}
		public void setFrom(String from) {
			this.from = from;
		}
		public String getTo() {
			return to;
		}
		public void setTo(String to) {
			this.to = to;
		}
		
		@Override
		public String toString() {
			return "FromTo [from=" + from + ", to=" + to + "]";
		}

		//[from, to),[from, to) 左包含from 右不包含to
		String from;
		String to;
		}
	
	public static class PositionCycle{
		public double getLat() {
			return lat;
		}
		public void setLat(double lat) {
			this.lat = lat;
		}
		public double getLon() {
			return lon;
		}
		public void setLon(double lon) {
			this.lon = lon;
		}
		public double getRadius() {
			return radius;
		}
		public void setRadius(double radius) {
			this.radius = radius;
		}
		
		@Override
		public String toString() {
			return "PositionCycle [lat=" + lat + ", lon=" + lon + ", radius="
					+ radius + "]";
		}

		double lat;
		double lon;
		double radius;
	}
}




